# coding:utf8
class HtmlOutputer(object):
	"""docstring for HtmlParser"""
	def __init__(self):
		self.datas = []

	def collect_data(self, data):
		if data is None:
			return
		self.datas.append(data)

	def output_html(self):
		fout = open('output.html','w')
		fout.write('<html>')
		fout.write('<body>')
		for data in self.datas:
			if data['url'] is not None and data['title'] is not None:
				fout.write("<a href='%(url)s'>%(title)s</a>" %{ 'url':data['url'].encode('utf-8'), 'title':data['title'].encode('utf-8')} )
				fout.write('<br>')

		fout.write('</body>')
		fout.write('</html>')
